# Contributor: Anil Madhavapeddy <anil@recoil.org>
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=clasp
pkgver=3.3.9
pkgrel=2
pkgdesc="Answer set solver for (extended) normal logic programs"
url="https://potassco.org/"
arch="all"
license="MIT"
makedepends="cmake samurai"
source="https://github.com/potassco/clasp/releases/download/v$pkgver/clasp-$pkgver-source.tar.gz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCLASP_BUILD_APP=ON \
		-DCLASP_BUILD_TESTS=ON \
		$CMAKE_CROSSOPTS
	cmake --build build
}

check() {
	CTEST_OUTPUT_ON_FAILURE=1 ninja -C build test
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
36cf171dfe825deae2f0ecaa1cae11a84d7cf1711f3e568ae001473f3aeb9fa28006ee66eb09cbfb56c2b040ae816d9b836d84c3842fea1155259fca9b2ad698  clasp-3.3.9-source.tar.gz
"
